package com.ykzb.page.service.impl;

import com.ykzb.classify.dao.IClassifyDao;
import com.ykzb.page.service.IIndexService;
import com.ykzb.classify.model.Classify;
import com.ykzb.project.dao.ICategoryDao;
import com.ykzb.project.model.CategoryInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by liang yj on 2017/3/20.
 */
@Service
public class IndexServiceImpl implements IIndexService{

    @Autowired
    private ICategoryDao categoryDao;


    /**
     * 跳到主页
     * @return
     */
    @Override
    public ModelMap toIndex(HttpServletRequest request) {

        ModelMap model = new ModelMap();
        Map<String,Object> param = new HashMap<String,Object>();
        param.put("type",0);
        List<CategoryInfo> categoryList = categoryDao.selectCategory(param);
        model.addAttribute("categoryList",categoryList);
        return model;

    }
}
